package com.tangcco.lockwell.controller.admin;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tangcco.lockwell.base.RestResponse;
import com.tangcco.lockwell.service.GradeStatisticsService;
import com.tangcco.lockwell.viewmodel.admin.groups.GroupsPageFindVM;
import com.tangcco.lockwell.viewmodel.admin.score.GradeStatistics;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController("AdminGradeStatisticsController")
@RequestMapping("/api/admin/score")
public class GradeStatisticsController {
    @Resource
    private GradeStatisticsService gradeStatisticsService;

    @RequestMapping("/findAll/Score")
    public RestResponse findAllCondition(@RequestBody GradeStatistics model){
        PageHelper.startPage(model.getPageIndex(),model.getPageSize());
        List<GradeStatistics> gradeStatistics = gradeStatisticsService.selectGradeStatistics(model);
        PageInfo pageInfo = new PageInfo(gradeStatistics);
        return RestResponse.ok(pageInfo);
    }
}
